﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ChkInputsDemo._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ChkInputs.js使用示例</title>
    <!-- 引用函数库ChkInputs.js的路径 //-->
    <script type="text/javascript" src="JS/ChkInputs.js"></script>
    <script language="javascript">
		    //例一，全部验证，比较常用,基本满足一般所有的验证功能
		    function CheckInfoAll()
		    {
		        return verifyAll(document.getElementById("form1"));
		    }
		    //例二，单一验证
		    function CheckInfo()
		    {
		        var v_msgtype =getMsgType();
		        setMsgType(1);//设置提示信息类型 1:单个弹出提示 
		        if(!verifyInput(document.getElementById("TextBox1")))
		        {
		            document.getElementById("TextBox1").focus();
		            document.getElementById("TextBox1").select();
		            CancelClientEvent();
		            setMsgType(v_msgtype);
		            return false;
		        }
		        else
		        {
		            setMsgType(v_msgtype);
		            return true;
		        }
		    }

		    //例三，验证下拉框
    		function CheckInfoDrp()
		    {
		        var v_msgtype =getMsgType();
		        setMsgType(1);//设置提示信息类型 1:单个弹出提示 
		        if(!verifyInput(document.getElementById("DropDownList1")))
		        {
		            document.getElementById("DropDownList1").focus();
		            setMsgType(v_msgtype);
		            return CancelClientEvent();
		        }
		        else
		        {
		            return true;
		        }
		    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div id="MessageId" style="color:Red;"></div>
        测试输入框
        <asp:TextBox ID="TextBox1" runat="server" MaxLength="10" ></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="指定验证" onfocus ="CheckInfo()"/><br />
        测试输入框2<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <asp:Button ID="Button2" runat="server" Text="验证所有" onfocus ="CheckInfoAll()" />&nbsp;<br />
        &nbsp;
        <br />
        <asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="CheckInfoAll" onmousedown="CheckInfoAll()" onkeydown="if(event.keyCode == 13){CheckInfoAll();}" /><br />
        <asp:Button ID="Button5" runat="server" OnClientClick="return CheckInfoAll()" OnClick="Button5_Click" TabIndex="2" Text="测试OnClientClick" /><br />
        <br />
        下拉框：<asp:DropDownList ID="DropDownList1" runat="server" Width="100px">
                    <asp:ListItem Selected="True"></asp:ListItem>
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem Value="2">2</asp:ListItem>
                </asp:DropDownList>
                <asp:Button ID="Button7" runat="server" onmousedown="return CheckInfoDrp();" Text="验证drop" /><br />
        <br />
        <asp:TextBox ID="TextBox3" runat="server" Width="300px"></asp:TextBox>
        <br />
        <br />
        <a href="CheckInputsDemo.htm" target="_blank">其它全部示例演示</a>
        
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <hr />
        <div>
            © lxchutao(楚涛) 2006-2009&nbsp; &nbsp; &nbsp;&nbsp; lxchutao@163.com &nbsp; &nbsp;&nbsp;
            QQ:290363711 <br />
            <a href="http://blog.csdn.net/chutao" target="_blank" >我的博客一</a><br />
            <a href="http://lxchutao.blog.163.com/" target="_blank" >我的博客二</a><br />
            <a href="http://download.enet.com.cn/eblog/blog/htm/uid_21280.html" target="_blank" >我的博客三</a><br />
            <a href="http://chutao.htmhome.com" target="_blank" >临时个人网址</a>
        </div>
    </form>
</body>
</html>
